<?php
/**
 * Template Name: Entertainment Template
 */
get_header();

//$terms = get_terms( 'entertainment_cat' );//get_the_terms( $post_id, 'entertainment_cat' );
//debug($terms);
global $dktmSetting;
$postId = @$dktmSetting['entertainment_id'];

if ($postId == "" || empty($postId)) {
    global $post;
    $postId = $post->ID;
}
//debug($postId);
$child_pages = get_pages(array('child_of' => $postId, 'sort_column' => 'post_date', 'sort_order' => 'desc'));
?>
<div class="" >
    <div id="primary">
        <div id="content" class="network-page single-page entertainment" role="main">
            <div class="wrapper">
                <article id="post-0">
                    <?php
                    $profs = new WP_Query(array('post_type' => 'page', 'page_id' => @$dktmSetting['entertainment_id']));
                    while ($profs->have_posts()) {
                        $profs->the_post();
                        // echo get_the_ID();
                        ?>
                        <header class="entry-header">
                            <h1 class="entry-title"><?php the_title(); ?></h1>

                        </header><!-- .entry-header -->
                        <div class="description"><?php the_content(); ?></div>
                        <?php }wp_reset_query();
                    ?>
                    <div class="entry-content">
                        <div class="network-listing clearfix" style="width: 100%;">
                            <?php
                            foreach ($child_pages as $page) {
                                //debug($page);
                                $thumbnail = get_the_post_thumbnail($page->ID, 'thumbnail-560x309');
                                $post_excerpt = $page->post_excerpt;
                                //$content = $page->post_content;
//		if ( ! $content ) // Check for empty page
//			continue;
//		$content = apply_filters( 'the_content', $content );
                                ?>
                            <div class="eachProf" style="width: 47%;margin: 0 1.5%;">
                                    <div class="transorm1">
                                        <div class="sliderImage1" style="text-align: center;">
                                            <a href="<?php echo get_permalink($page->ID); ?>"><h2><?php echo $page->post_title; ?></h2></a>
                                            <a href="<?php echo get_permalink($page->ID); ?>"><?php echo $thumbnail; ?></a>
    <?php //echo $post_excerpt; ?>
                                        </div>
                                    </div>

                                </div>
                                <?php
                            }
                            ?>
                        </div>
                    </div><!-- .entry-content -->
                </article><!-- #post-<?php the_ID(); ?> -->

            </div>
        </div><!-- #content -->
    </div>
<?php //get_sidebar('entertainment');  ?>
    <div class="clear"></div>
</div>

<?php get_footer(); ?>